<template>
	<view class="page_view">
		<view>
			<u-tabs
			  :list="list1"
				@click="handleClick"
				:current="current"
				:activeStyle="{
					fontFamily: 'Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20',
					fontWeight: 'normal',
					fontSize: '30rpx',
					color: '#333333'
				}"
				:inactiveStyle="{
					fontFamily: 'Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20',
					fontWeight: 'normal',
					fontSize: '30rpx',
					color: '#999999'
				}"
			></u-tabs>
		</view>
		<view class="list_item" v-for="(item,index) in list">
			<view class="list_item_top">
				+{{item.value}}
			</view>
			<view class="list_item_bottom flex1">
				<view class="list_item_bottom_item">
					<text v-if="current == 1">任务名称：</text>
					<text v-if="current == 0">陪诊名称</text>
					<text>{{item.title}}</text>
				</view>
				<view class="list_item_bottom_item">
					入账时间：{{item.created_at}}
				</view>
			</view>
		</view>
		<u-empty mode="data" v-if="list.length == 0"></u-empty>
	</view>
</template>

<script>
	import{finance} from '@/api/common.js'
	export default {
		data() {
			return {
				last_page: '',
				page: 1,
				list: [],
				current: 0,
				list1: [
					{
						name: '陪诊任务'
					},
					{
						name: '知识分享任务'
					}
				]
			}
		},
		onLoad(){
			this.getlist()
		},
		onReachBottom() {
			let t = this
			if(t.page<this.t.last_page){
				t.page ++;
				t.getlist()
			}
		},
		methods: {
			getlist(){
				let t = this
				finance().then(res=>{
					console.log(res)
					t.last_page = res.data.last_page
					t.list = [...t.list,...res.data.data] 
				})
			},
			handleClick(e) {
				console.log(e)
				this.current = e.index
			}
		}
	}
</script>

<style>
	.page_view{
		padding-bottom: 50rpx;
	}
.list_item{
	width: 100%;
	/* height: 146rpx; */
	padding:30rpx;
	box-sizing: border-box;
	border: 1rpx solid #F4F4F4;
}
.list_item_top{
	color: #333;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 30rpx;
	font-weight: 400;
}
.list_item_bottom{
	margin-top: 10rpx;
}
.list_item_bottom_item{
	color: #999;
	font-family: Alibaba PuHuiTi 2.0;
	font-size: 24rpx;
	font-weight: 400;
}
/deep/.u-empty{
	margin-top: 300rpx !important;
}
</style>
